import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import '../controllers/fission_controller.dart';
import '../l10n/app_localizations.dart';

class FissionEarnings extends StatelessWidget {
  const FissionEarnings({super.key});

  @override
  Widget build(BuildContext context) {
    final FissionController controller = Get.find();
    final l10n = AppLocalizations.of(context);

    return Container(
      margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
      child: Column(
        children: [
          // 裂变收益显示
          Container(
            padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
            decoration: BoxDecoration(
              image: DecorationImage(
                image: AssetImage("assets/images/bg_section.png"),
                fit: BoxFit.fill,
              ),
            ),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  l10n.fissionEarnings,
                  style: TextStyle(
                    color: Color(0xFF05FFFD),
                    fontSize: 14.sp,
                    fontWeight: FontWeight.w600,
                  ),
                ),
                Obx(
                  () => Text(
                    '${controller.fissionEarnings.value} btc',
                    style: TextStyle(
                      color: const Color(0xFFFFFFFF),
                      fontSize: 20.sp,
                      fontWeight: FontWeight.w600,
                    ),
                  ),
                ),
              ],
            ),
          ),

          SizedBox(height: 16.h),

          // 提现按钮
          GestureDetector(
            onTap: () => controller.withdraw(),
            child: Container(
              width: 184.w,
              height: 48.h,
              decoration: BoxDecoration(
                image: DecorationImage(
                  image: AssetImage("assets/images/btn_withdraw.png"),
                  fit: BoxFit.fitWidth,
                ),
              ),
              child: Center(
                child: Text(
                  l10n.withdraw,
                  style: TextStyle(
                    color: const Color(0xFF061125),
                    fontSize: 16.sp,
                    fontWeight: FontWeight.w600,
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
